 var id = getvl("id");
 	getOneAdmin2();
 var userid="";	
var pageNo=1;
function getOneAdmin2() {
	$.ajax({
		url: urlcore + "/api/user/getadmin",
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
				userid=data.data.id;
			chaxunyonghusuoyoudizhi();
			}
		},
		error:function() {
			/* Act on the event */
			alert("error");
		}
	});	
}
 //$("#dizhi").html("");

var ss=0;
function chaxunyonghusuoyoudizhi(){
	if(ss!=0 || pageNo==1 || page==2){

	$.ajax({
		url: urlcore + "/api/address/selectAddressAll?current="+pageNo+"&userId="+userid,
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
				ss=data.data.list.length;
				//alert()
				$.each(data.data.list, function(y,n) {
				var dizhi="";
       if(n.level==1){
       			dizhi+='<div class="a_addr curr" name="'+n.id+'" onclick="dianjithis(this)">'+
'    <div class="a_addr_1 clearfix">'+
'        <div class="a_addr_2">'+
'            <h3>'+n.userName+'<span>'+n.userPhone+'</span><i>默认的</i></h3>'+
'            <p>'+n.address+'</p>'+
'        </div>'+
'        <div class="a_xiugai">'+
'            <a href="11.2.1dizhi_add.html?userId='+n.id+'">'+
'                <img src="images/a_xiugaitubiao.png">'+
'            </a>'+
'        </div>'+
'    </div>'+
'</div>';

       }else if(n.level==0){
                dizhi+='<div class="a_addr" name="'+n.id+'"  onclick="dianjithis(this)">'+
'    <div class="a_addr_1 clearfix">'+
'        <div class="a_addr_2">'+
'            <h3>'+n.userName+'<span>'+n.userPhone+'</span></h3>'+
'            <p>'+n.address+'</p>'+
'        </div>'+
'        <div class="a_xiugai">'+
'            <a href="11.2.1dizhi_add.html?userId='+n.id+'">'+
'                <img src="images/a_xiugaitubiao.png">'+
'            </a>'+
'        </div>'+
'    </div>'+
'</div>';
       }
              $("#dizhi").append(dizhi);
				});
			}
		},
		error:function() {
			/* Act on the event */
			alert("error");
		}
	});	
		
	}
}



function dianjithis(te){
	
	$(".curr").each(function(){
		
	   	   $(this).attr("class","a_addr");
	});
	$(te).attr("class","a_addr curr");
	sessionStorage.setItem("dizhiid",$(te).attr("name"));
	
}
